package com.ygo.feihua.fragment;
import android.os.*;
import android.support.v4.app.*;
import android.support.v4.util.*;
import android.support.v7.widget.*;
import android.view.*;
import com.ygo.feihua.*;
import com.ygo.feihua.adapter.*;
import java.util.*;
import com.xiaomi.mistatistic.sdk.*;

public class FragmentBankuai extends Fragment
{

	RecyclerView bk_rec;
	
	List<Map<String,Object>> data=new ArrayList<Map<String,Object>>();
	
	
	
	@Override
	public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
	{
		View v=inflater.inflate(R.layout.fragment_bankuai,null);
		bk_rec=(RecyclerView) v.findViewById(R.id.bk_rec);
		new Handler().postDelayed(new Runnable() {

				@Override
				public void run() {
					// TODO Auto-generated method stub
					bkcsh();	
					han.sendEmptyMessage(0);
				}
			}, 250);
		
		
		// TODO: Implement this method
		return v;
	}

	@Override
	public void onResume(){
		// TODO: Implement this method
		super.onResume();
		MiStatInterface.recordPageStart(getActivity(), "板块");
	}

	@Override
	public void onPause(){
		// TODO: Implement this method
		super.onPause();
		MiStatInterface.recordPageEnd();
	}
	
	private void bkcsh()
	{
		Map<String,Object> map=new ArrayMap<String,Object>();
		map.put("title","手机版游戏王");
		List<Map<String,Object>> li=new ArrayList<Map<String,Object>>();
		Map<String,Object> mapl=new ArrayMap<String,Object>();
		mapl.put("tb",R.drawable.it_zy);
		mapl.put("name","资源更新");
		li.add(mapl);
		
		Map<String,Object> mapl1=new ArrayMap<String,Object>();
		mapl1.put("tb",R.drawable.it_zt);
		mapl1.put("name","主题下载");
		li.add(mapl1);
		
		Map<String,Object> mapl2=new ArrayMap<String,Object>();
		mapl2.put("tb",R.drawable.it_diy);
		mapl2.put("name","卡片DIY");
		li.add(mapl2);
		
		Map<String,Object> mapl4=new ArrayMap<String,Object>();
		mapl4.put("tb",R.drawable.image_20);
		mapl4.put("name","数据库编辑");
		li.add(mapl4);
		
		Map<String,Object> mapl5=new ArrayMap<String,Object>();
		mapl5.put("tb",R.drawable.image_17);
		mapl5.put("name","卡图管理");
		li.add(mapl5);
		
		Map<String,Object> mapl6=new ArrayMap<String,Object>();
		mapl6.put("tb",R.drawable.image_21);
		mapl6.put("name","残局编辑");
		li.add(mapl6);
		
		Map<String,Object> mapl7=new ArrayMap<String,Object>();
		mapl7.put("tb",R.drawable.image_19);
		mapl7.put("name","文字组卡");
		li.add(mapl7);
		
		Map<String,Object> mapl8=new ArrayMap<String,Object>();
		mapl8.put("tb",R.drawable.image_24);
		mapl8.put("name","lua编辑");
		li.add(mapl8);
		
		/*Map<String,Object> mapl9=new ArrayMap<String,Object>();
		mapl9.put("tb",R.drawable.image_22);
		mapl9.put("name","随机组卡");
		li.add(mapl9);*/
		
		
		map.put("mk",li);
		data.add(map);	
		skcsh();
		
		
		// TODO: Implement this method
	}
	
	Handler han=new Handler(){

		@Override
		public void handleMessage(Message msg)
		{
			// TODO: Implement this method
			super.handleMessage(msg);
			switch(msg.what){
				case 0:
			LinearLayoutManager llm=new LinearLayoutManager(getActivity());
			bk_rec.setLayoutManager(llm);
			bk_rec.setAdapter(new AdapterBankuai(getActivity(),data));

			break;
			}
			
		}
		
		
	};
	
	private void skcsh(){
		Map<String,Object> map=new ArrayMap<String,Object>();
		map.put("title","实卡相关");
		List<Map<String,Object>> li=new ArrayList<Map<String,Object>>();
		Map<String,Object> mapl=new ArrayMap<String,Object>();
		mapl.put("tb",R.drawable.it_kd);
		mapl.put("name","卡店");
		li.add(mapl);

		Map<String,Object> mapl1=new ArrayMap<String,Object>();
		mapl1.put("tb",R.drawable.ic_duel);
		mapl1.put("name","决斗工具");
		li.add(mapl1);

		Map<String,Object> mapl2=new ArrayMap<String,Object>();
		mapl2.put("tb",R.drawable.ygoroid);
		mapl2.put("name","无卡面基");
		li.add(mapl2);
		
		Map<String,Object> mapl3=new ArrayMap<String,Object>();
		mapl3.put("tb",R.drawable.it_kc);
		mapl3.put("name","卡片查询");
		li.add(mapl3);
			
		map.put("mk",li);
		
		data.add(map);
		lmcsh();
		qtcsh();
	}
	
	private void qtcsh(){
		Map<String,Object> map=new ArrayMap<String,Object>();
		map.put("title","其他");
		List<Map<String,Object>> li=new ArrayList<Map<String,Object>>();
		Map<String,Object> mapl=new ArrayMap<String,Object>();
		mapl.put("tb",R.drawable.feihua);
		mapl.put("name","机器人小废");
		li.add(mapl);

		
		Map<String,Object> mapl1=new ArrayMap<String,Object>();
		mapl1.put("tb",R.drawable.ic_233);
		mapl1.put("name","ygo233服");
		li.add(mapl1);
		
		map.put("mk",li);

		data.add(map);
		
	}
	
	private void lmcsh(){
		Map<String,Object> map=new ArrayMap<String,Object>();
		map.put("title","YGOPRO战队联盟");
		List<Map<String,Object>> li=new ArrayList<Map<String,Object>>();
		Map<String,Object> mapl=new ArrayMap<String,Object>();
		mapl.put("tb",R.drawable.it_pb);
		mapl.put("name","排表");
		li.add(mapl);

		Map<String,Object> mapl1=new ArrayMap<String,Object>();
		mapl1.put("tb",R.drawable.mc_logo);
		mapl1.put("name","YGOPro社区");
		li.add(mapl1);
		
		
		map.put("mk",li);

		data.add(map);
		
		
	}
	
}
